<?php

use Illuminate\Support\Facades\Route;

// 引入控制器类
use App\Http\Controllers\Home\IndexController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\Login\LoginController;
use App\Http\Controllers\UploadsController;
use App\Http\Controllers\BannerController;
use App\Http\Controllers\NewsController;
use App\Http\Controllers\LawyerController;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\BusinessController;
use App\Http\Controllers\AboutController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get("/", [IndexController::class, 'index']);
Route::get("sh/index", [IndexController::class, 'sh_index']);
Route::get("sh/detail", [IndexController::class, 'sh_detail']);
Route::get("/news/index", [IndexController::class, 'news_index']);
Route::get("/news/detail", [IndexController::class, 'news_detail']);
Route::get("/lawyer/index", [IndexController::class, 'lawyer']);
Route::get("/lawyer/detail", [IndexController::class, 'lawyer_detail']);
Route::get("/business/index", [IndexController::class, 'business']);
Route::get("/business/list", [IndexController::class, 'business_list']);
Route::get("/business/detail", [IndexController::class, 'business_detail']);
Route::get("/contact/index", [IndexController::class, 'contact_index']);
Route::get("/course/detail", [IndexController::class, 'course_detail']);
Route::get("/about/index", [IndexController::class, 'about_index']);


Route::domain(env('ADMIN_DOMAIN'))->group(function () {
    Route::get("login", [LoginController::class, 'index']);
    Route::post("login", [LoginController::class, 'login']);
    Route::get('logout', [LoginController::class, 'logout']);

    Route::group(['middleware' => ['auth.as']], function () {

        Route::get("home", [HomeController::class, 'index']);

        Route::group(['prefix' => '/common/'], function () {
            // 文件上传
            Route::post('uploads/avatar', [UploadsController::class, 'avatar']);
            Route::post('uploads/images', [UploadsController::class, 'images']);
            Route::post('uploads/file', [UploadsController::class, 'file']);

        });

        // 关于我们的
        Route::group(['prefix' => '/about/'], function(){
            // 发展历程
            Route::get("course", [AboutController::class, 'course']);
            Route::get("course/list", [AboutController::class, 'course_list']);
            Route::get("course/create", [AboutController::class, 'course_create']);
            Route::post("course/create", [AboutController::class, 'course_save']);
            Route::get("course/delete", [AboutController::class, 'course_delete']);

            // 关于我们简介
            Route::get("about/index", [AboutController::class, 'about_index']);
            Route::post("about/create", [AboutController::class, 'about_save']);

            // 联系我们
            Route::get("contact/index", [AboutController::class, 'contact_index']);
            Route::post("contact/create", [AboutController::class, 'contact_save']);

            // 基本设置
            Route::get("setting/index", [AboutController::class, 'setting_index']);
            Route::post("setting/create", [AboutController::class, 'setting_save']);

        });

        // 设置banner图片
        Route::group(['prefix' => '/banner/'], function (){
           Route::get("index", [BannerController::class, 'index']);
            Route::post("create", [BannerController::class, 'save']);
        });

        // 律师团队
        Route::group(['prefix' => '/lawyer/'], function(){
            Route::get("index", [LawyerController::class, 'index']);
            Route::get("list", [LawyerController::class, 'list']);
            Route::get("create", [LawyerController::class, 'create']);
            Route::post("create", [LawyerController::class, 'save']);
            Route::get("delete", [LawyerController::class, 'delete']);
        });

        // 社会责任
        Route::group(['prefix' => '/shzr/'], function () {
            Route::get("index", [NewsController::class, 'sh_index']);
            Route::get("list", [NewsController::class, 'list']);
            Route::get("create", [NewsController::class, 'create']);
            Route::post("create", [NewsController::class, 'save']);
            Route::get("delete", [NewsController::class, 'delete']);
        });
        // 新闻资讯
        Route::group(['prefix' => '/news/'], function () {
            Route::get("index", [NewsController::class, 'index']);
            Route::get("list", [NewsController::class, 'list']);
            Route::get("create", [NewsController::class, 'create']);
            Route::post("create", [NewsController::class, 'save']);
            Route::get("delete", [NewsController::class, 'delete']);
        });

        // 业务领域
        Route::group(['prefix' => '/business/'], function () {
            // 分类
            Route::group(['prefix'=> '/category/'], function () {
                Route::get("index", [CategoryController::class, 'index']);
                Route::get("list", [CategoryController::class, 'list']);
                Route::get("create", [CategoryController::class, 'create']);
                Route::post("create", [CategoryController::class, 'save']);
                Route::get("delete", [CategoryController::class, 'delete']);
            });

            // 信息
            Route::get("index", [BusinessController::class, 'index']);
            Route::get("list", [BusinessController::class, 'list']);
            Route::get("create", [BusinessController::class, 'create']);
            Route::post("create", [BusinessController::class, 'save']);
            Route::get("delete", [BusinessController::class, 'delete']);
        });

    });
});